/*
 * FrontCodingEncoder.h
 *
 *  Created on: Nov 5, 2012
 *      Author: m
 */

#ifndef FRONTCODINGENCODER_H_
#define FRONTCODINGENCODER_H_

#include <string>
#include <algorithm>

class FrontCodingEncoder
{
private:
    std::string m_key;

public:
    typedef unsigned char encoderHeader_t;

    struct FrontCodedString
    {
        std::string string;
        encoderHeader_t header;

        FrontCodedString();

        FrontCodedString( const std::string& str,
                const encoderHeader_t& factor );

        FrontCodedString& operator =( const FrontCodedString& rhs );
    };

public:

    FrontCodingEncoder();

    virtual ~FrontCodingEncoder();

    void setKey( const std::string& newKey );

    void resetKey();

    FrontCodedString encode( const std::string& str );

    std::string decode( const FrontCodedString& er );
};

#endif /* FRONTCODINGENCODER_H_ */
